package com.maixy.dailydemo.design.proxy;

/**
 * @ClassName ProviderProxy
 * @Description TODO
 * @Date 2021/4/25 9:40
 * @Author maixy
 */
public class ProviderProxy implements IProvider{
    //持有一个被代理对象的引用
    IProvider iProvider;
    public ProviderProxy(IProvider iProvider) {
        this.iProvider = iProvider;
    }

    @Override
    public Object getData(String json) {
        //静态代理实现
        System.out.println("判断是否该限流");
        return iProvider.getData(json);
    }

    public static void main(String[] args) {
        IProvider iProvider = new ProviderProxy(new SimpleProvider());
        iProvider.getData("111");
    }
}
